@echo off
REM Copyright (c) 1995-2012 Xilinx, Inc.  All rights reserved.

REM Set current working directory
set XIL_SCRIPT_LOC=%~dp0
REM Remove trailing slash
set XIL_SCRIPT_LOC=%XIL_SCRIPT_LOC:~0,-1%
REM Call settings file for each product
set xlnxInstLocList=
set xlnxInstLocList=%xlnxInstLocList% common
set xlnxInstLocList=%xlnxInstLocList% EDK
set xlnxInstLocList=%xlnxInstLocList% common/CodeSourcery
set xlnxInstLocList=%xlnxInstLocList% PlanAhead
set xlnxInstLocList=%xlnxInstLocList% ../../Vivado/2012.4
set xlnxInstLocList=%xlnxInstLocList% ISE
for %%d in (%xlnxInstLocList%) do (
	if EXIST %XIL_SCRIPT_LOC%\%%d\.settings32.bat (
		call %XIL_SCRIPT_LOC%\%%d\.settings32.bat
	)
)
REM Unset XIL_SCRIPT_LOC
set XIL_SCRIPT_LOC=
REM Execute command if any
if "%1" neq "" (
   if /i "%~x1" == ".bat" (
      call %*
   ) else (
      start %*
   )
)
REM Unset xlnxInstLocList
set xlnxInstLocList=
